package cn.xshi.bpm.service.impl;
import java.util.List;
import java.util.Map;

import cn.xshi.bpm.service.LcBtnService;
import cn.xshi.common.base.BaseService;
import cn.xshi.common.util.ExceptionUtil;
import org.springframework.stereotype.Service;
import cn.xshi.bpm.dao.LcBtnDao;
import cn.xshi.bpm.model.LcBtn;
import javax.annotation.Resource;
/**
* @Desc 按钮 
* @Author 邓纯杰
* @CreateTime 2022-03-31 16:31:14
*/
@Service
public class LcBtnServiceImpl extends BaseService implements LcBtnService {

	@Resource
	private LcBtnDao lcBtnDao;

	/**
	* 分页
	* @param condition 
	* @return
	*/
	public List<LcBtn> getLcBtnListByCondition(Map<String,Object> condition){
		try{
			return lcBtnDao.getLcBtnListByCondition(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 查询对象
	* @param btn_id 
	* @return
	*/
	public LcBtn getLcBtnById(String btn_id){
		try{
			LcBtn lcBtn = lcBtnDao.getLcBtnById(btn_id);
			return lcBtn;
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
	}

	/**
	* 添加
	* @param lcBtn 
	* @return
	*/
	public int addLcBtn(LcBtn lcBtn){
		int i = 0;
		try {
			lcBtn.setCreateId(getCurrentAccountId());
			lcBtn.setCreateTime(getDate());
			lcBtn.setId(toUUID());
			i = lcBtnDao.addLcBtn(lcBtn);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改
	* @param lcBtn 
	* @return
	*/
	public int updateLcBtn(LcBtn lcBtn){
		int i = 0;
		try {
			lcBtn.setUpdateId(getCurrentAccountId());
			lcBtn.setUpdateTime(getDate());
			i = lcBtnDao.updateLcBtn(lcBtn);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 修改（根据动态条件）
	* @param lcBtn 
	* @return
	*/
	public int updateLcBtnBySelective(LcBtn lcBtn){
		int i = 0;
		try {
			i = lcBtnDao.updateLcBtnBySelective(lcBtn);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}

	/**
	* 删除
	* @param condition 
	* @return
	*/
	public int delLcBtn(Map<String,Object> condition){
		int i = 0;
		try {
			i = lcBtnDao.delLcBtn(condition);
		} catch (Exception e) {
			throw new ExceptionUtil(e.getMessage(),e.getCause());
		}
		return i;
	}
}
